Memory leak with Linkref

i manage a very complex project with a lot of DXL attributes and scripts.
I noticed that the use of the Linkref make the project become very slow and heavy.
Did i suppose right?
SystemAdmin - Wed Feb 27 03:57:31 EST 2013

Re: Memory leak with Linkref
Mathias Mamsch - Wed Feb 27 10:13:49 EST 2013

No, there is nothing wrong with LinkRefs in DXL. Can you describe what exactly means 'your project becomes very slow and heavy'? What is a heavy project? What project? You mean the execution speed of your DXL attributes??

Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: Memory leak with Linkref
SystemAdmin - Wed Feb 27 10:28:33 EST 2013

Mathias Mamsch - Wed Feb 27 10:13:49 EST 2013
No, there is nothing wrong with LinkRefs in DXL. Can you describe what exactly means 'your project becomes very slow and heavy'? What is a heavy project? What project? You mean the execution speed of your DXL attributes??

Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Yes i mean the execution of the scripts is slow. To save a module including that dxl attribute is slow, scrolling the module is slow

This is part of the code of my dxl attribute.
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
LinkRef l
//i check for each incoming link and according to the link module name or the source name i set some variable.
Module m_linkModule
ModName_ srcModRef
ModName_ trgModRef
string s_linkModName
string s_srcMod
for l in o<-"*" do {
m_linkModule = module(l)
s_linkModName = fullName(m_linkModule)""
srcModRef = source l
s_srcMod=name srcModRef
if (name m==s_srcMod) {
b_isDerived = true
}else if(s_linkModName == s_PropLink) {
b_isAllocated = true
break
} else if (s_srcMod0:2=="AD_") {
b_isSatisfied = true
// da valutare se mettere un break
}
}
///////////////////////////////////////////////////////////////////////////////////

Re: Memory leak with Linkref
Mathias Mamsch - Wed Feb 27 11:52:16 EST 2013

SystemAdmin - Wed Feb 27 10:28:33 EST 2013
Yes i mean the execution of the scripts is slow. To save a module including that dxl attribute is slow, scrolling the module is slow

This is part of the code of my dxl attribute.
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
LinkRef l
//i check for each incoming link and according to the link module name or the source name i set some variable.
Module m_linkModule
ModName_ srcModRef
ModName_ trgModRef
string s_linkModName
string s_srcMod
for l in o<-"*" do {
m_linkModule = module(l)
s_linkModName = fullName(m_linkModule)""
srcModRef = source l
s_srcMod=name srcModRef
if (name m==s_srcMod) {
b_isDerived = true
}else if(s_linkModName == s_PropLink) {
b_isAllocated = true
break
} else if (s_srcMod0:2=="AD_") {
b_isSatisfied = true
// da valutare se mettere un break
}
}
///////////////////////////////////////////////////////////////////////////////////

Well, when it is really very slow, chances are that you are a) using Layout DXL and not attribute DXL and b) you might be opening and closing modules all the time and/or c) may have expensive recursive algorithms to trace from your objects.

The code you posted contains no hint to any performance issue. It is likely that some other part of the code creates the problem. If you post the whole code we could probably say more.

Regards, Mathias

Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: Memory leak with Linkref
SystemAdmin - Wed Feb 27 11:55:54 EST 2013

Mathias Mamsch - Wed Feb 27 11:52:16 EST 2013
Well, when it is really very slow, chances are that you are a) using Layout DXL and not attribute DXL and b) you might be opening and closing modules all the time and/or c) may have expensive recursive algorithms to trace from your objects.

The code you posted contains no hint to any performance issue. It is likely that some other part of the code creates the problem. If you post the whole code we could probably say more.

Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

in the old code we opened and close modules and it was faster.
anyway here it is the whole code

// V. 1.0
// Alstom Requirement Identification script
// Copyright Altran Italia

/*
The "ReqStatus" attribute report the status of a Requirement.

*/

#include </DXL Libraries/AlstomProjectConfigurationParameters.inc>
/*
Purpose: la funzione trova il linkmodule di allocazione
@param s_path: path dentro cui cercare
ritorna il fullname del linkmodule
*/
string allocationLM(string s_path) {

Folder f_lm = folder s_path
Item item
Module m_lm
string s_descriptionlm
string s_LM=""
for item in f_lm do {
//m_lm=module fullName(item)
s_descriptionlm=description item
if (s_descriptionlm0:9=="Allocation") {
s_LM=fullName(item)
break
}
}
return s_LM
}
pragma runLim, 0

LinkRef l
Object o = obj
string myoutput=""
bool b_isSatisfied = false
bool b_isAllocated = false
bool b_isDerived = false
bool tempFTS = false
int i_off
int i_len

string s_subSysModName
string s_currentModName
string s_srcModName
string s_prjName
string s_prgCode
Module m= current
// Apertura dei possibili moduli
string s_RTF = richText o."Object Text"
if (o.s_isRequirement "" == "True") {
bool IsNotStriked=(!(findPlainText (s_RTF, "\\strike", i_off, i_len, false)))
if (IsNotStriked) {
s_prjName = name(current Project)
findPlainText(s_prjName," ",i_off,i_len,false)
s_prgCode = s_prjName0:i_off-1

string s_PropLink= allocationLM("/" s_prgCode "/" s_prgCode " Link Modules/")
// OLD CODE
/* s_currentModName = fullName(current Module)
while(findPlainText(s_currentModName,"RS",i_off,i_len,false)){
string s_toReplace = "AD"
s_ADModuleModName = replaceRichText(s_currentModName, i_off, length(s_toReplace), s_toReplace)
s_currentModName = s_ADModuleModName
}
m_ADModule = read(s_ADModuleModName,false)

s_subSysModName = o."ReqSubsysAlloc"
s_prjName = name(current Project)
findPlainText(s_prjName," ",i_off,i_len,false)
s_prgCode = s_prjName0:i_off-1

if(s_subSysModName != ""){
s_srcModName = "/Alstom-" s_prgCode "/" s_prgCode " Subsystem Level Specifications/" s_prgCode " RS_L2/" s_subSysModName

}else {
s_srcModName = s_subSysModName

}
m_subSysModule = read(s_srcModName,false)
*/ // END OLD CODE
//per default un requisito รจ Identified
myoutput="Identified"

Module m_linkModule
ModName_ srcModRef
ModName_ trgModRef
string s_linkModName
string s_srcMod
for l in o<-"*" do {
m_linkModule = module(l)
s_linkModName = fullName(m_linkModule)""
srcModRef = source l
s_srcMod=name srcModRef
if (name m==s_srcMod) {
b_isDerived = true
}else if(s_linkModName == s_PropLink) {
b_isAllocated = true
break
} else if (s_srcMod0:2=="AD_") {
b_isSatisfied = true
// da valutare se mettere un break
}
}

//This part implement the logic to correctly set the attribute value. It works together with the
//S.U.V.ToSatisfy script (which manually set the transition of FallenToSuV to false).
myoutput="Identified"
//inutile questo if
if (b_isDerived==true){
myoutput="Identified"
}
if (b_isAllocated){
myoutput="Allocated"
}
if (b_isSatisfied){
myoutput="Satisfied"
}
if (o."Aligned_Status""" =="False"){
tempFTS=true
} else {
tempFTS=o."FallenToSUV"
}
if (b_isSatisfied==false && tempFTS==true){
o."FallenToSUV"="false"
} else {
o."FallenToSUV"=tempFTS
}
if (b_isSatisfied==true && tempFTS==false){
myoutput="Satisfied"
}
if (b_isSatisfied==true && tempFTS==true){
myoutput="S.U.V."
}
if (o."ReqID""" ==""){
myoutput=""
}
}
else {
myoutput="Obsolete"
}
o."ReqStatus"=myoutput
}